home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 90 / CDMM_90_1.ISO / Cycling Manager 2 / CyclingManager2Demo.exe / Disk1 / data1.cab / Game / DataCM2 / scripts / pages / systest.cnc < prev    next >
Encoding:
Text File  |  2002-05-10  |  32.6 KB  |  1,417 lines

  1. func i32x SysTest_OnCreate()
  2. {
  3.     var Gui_Component pthis,ptab;
  4.     var Gui_dtPage_SysTest pdtData;
  5.     var i32x i;
  6.  
  7.     // get this pointer
  8.     pthis = GetThis();
  9.  
  10.     SetComponentNumber(pthis,12);
  11.  
  12.     // Set Data pointer
  13.     pdtData = new Gui_dtPage_SysTest;
  14.     SetData(pthis,pdtData);
  15.  
  16.     // members init
  17.     pdtData.m_iRaceRunning = 0;
  18.     pdtData.m_iHandshake = 0;
  19.     pdtData.m_iWaitForPos = 0;
  20.     pdtData.m_bForceLoad = false;
  21.     pdtData.m_bLogued = false;
  22.  
  23.     // Create System test page
  24.     // Create background
  25.     pdtData.gcBackground = NewMesh(s3dmBackground);
  26.     StretchTo(pdtData.gcBackground,g_iScreenWidth,g_iScreenHeight);
  27.     SetAlign(pdtData.gcBackground,e_GUI_HAlign_Center,e_GUI_VAlign_Center);
  28.  
  29.     // Panel Background
  30.     pdtData.gcTopPanel=NewBitmap(smTopPanel,0);
  31.     SetAlign(pdtData.gcTopPanel,e_GUI_HAlign_Zoom,e_GUI_VAlign_Top);
  32.     StretchTo(pdtData.gcTopPanel,g_iScreenWidth,SizeY(pdtData.gcTopPanel));
  33.     MoveTo(pdtData.gcTopPanel,0,0);
  34.  
  35.     g_iScreenTopOffset = SizeY(pdtData.gcTopPanel);
  36.  
  37.     // Page selector
  38.     pdtData.gcControlTab = NewTabControl();
  39.  
  40.     // Mount component in page
  41.     MountComponent(pthis,pdtData.gcBackground);
  42.     MountComponent(pthis,pdtData.gcTopPanel);
  43.     MountComponent(pthis,pdtData.gcControlTab);
  44.     
  45.     // Construct pages
  46.     MakePages();
  47.  
  48.     pdtData.m_iPageId = g_Page_Start;
  49.     // Add page to TabControl
  50.     i=0;
  51.     while(i<g_iNumPages)
  52.     {
  53.         ptab = g_stPage[i].gcPage;
  54.         pdtData.gcControlTab<<AddTab(ptab);
  55.         i=i+1;
  56.     }
  57.  
  58.     // Display the first page
  59.     if(g_iNumPages>0)
  60.     {
  61.         ptab = g_stPage[g_iFirstPage].gcPage;
  62.         if(g_stPage[g_iFirstPage].bCreated == false)
  63.         {
  64.             ptab<<Create();
  65.         }
  66.         pdtData.gcControlTab<<BackgroundTab(g_Page_Start);
  67.         pdtData.gcControlTab<<ShowTab(g_iFirstPage);
  68.     }
  69.  
  70.     // Global command
  71.     pdtData.gcContextualHelp = NewCaption(smBauer,"Help string");
  72.     StretchTo(pdtData.gcContextualHelp,g_iScreenWidth,SizeY(pdtData.gcContextualHelp));
  73.     SetAlign(pdtData.gcContextualHelp,e_GUI_HAlign_Center,e_GUI_HAlign_Center);
  74.     MountComponent(pthis,pdtData.gcContextualHelp);
  75.     pdtData.gcContextualHelp<<Hide();
  76.  
  77.     pdtData.gcJoinRace = NewCM2Button(GetLocalizedFromKey(iszCourse));
  78.     MountComponent(pthis,pdtData.gcJoinRace);
  79.     MoveTo(pdtData.gcJoinRace,g_iScreenWidth-SizeX(pdtData.gcJoinRace),5);
  80.     pdtData.gcJoinRace<<Hide();
  81.  
  82.  
  83.     // Progress bar
  84.     pdtData.gcProgressBar = NewProgressBar();
  85.     MountComponent(pthis,pdtData.gcProgressBar);
  86.     pdtData.gcProgressBar<<Disable();
  87.     pdtData.gcProgressBar<<Hide();
  88.     MoveTo(pdtData.gcProgressBar,g_iScreenWidthDiv2 - (SizeX(pdtData.gcProgressBar)/2),g_iScreenHeightDiv2 - (SizeY(pdtData.gcProgressBar)/2));
  89.  
  90.     // Hint
  91.     pdtData.gcHint = NewHint();
  92.     MountComponent(pthis, pdtData.gcHint);
  93.  
  94.     // Stretch page
  95.     StretchTo(pthis,g_iScreenWidth,g_iScreenHeight);
  96.  
  97. }
  98.  
  99. func void SysTest_OnSendEvent(i32x _iEventType,i32x _iPreRaceCyclistIndex,i32x _iParam1,i32x _iParam2,szx _szParam)
  100. {
  101.     var Gui_Component pthis;
  102.     var Gui_dtPage_SysTest pdtData;
  103.  
  104.     // get this pointer
  105.     pthis = GetThis();
  106.  
  107.     // Get Data pointer
  108.     pdtData = GetData(pthis);
  109. }
  110.  
  111. func i32x SysTest_OnDestroy()
  112. {
  113.     // uninit System test page
  114.     print("Destroy System page\n");
  115. }
  116.  
  117. func void SysTest_OnRaceDisconnect()
  118. {
  119.     var Gui_Component pthis;
  120.     var Gui_dtPage_SysTest pdtData;
  121.  
  122.     // get this pointer
  123.     pthis = GetThis();
  124.  
  125.     // Get Data pointer
  126.     pdtData = GetData(pthis);
  127.  
  128.     // Handshake must be done
  129.     pdtData.m_iHandshake = 0;
  130.     pdtData.m_iWaitForPos = 0;
  131.  
  132.     // Tell server to stop sending message
  133.     g_pMenuServerSocket<<mStopUDP();
  134.     // Stop client race
  135.     StopRace();
  136. }
  137. func void SysTest_OnRaceConnect()
  138. {
  139.     //send a message to the menuserver to say i am ready to receive interface,events,sprints
  140.     g_pMenuServerSocket<<mInRaceReady();
  141. }
  142.  
  143. func void SysTest_OnDatabaseSync()
  144. {
  145.     var Gui_Component pthis,gcPage;
  146.     var Gui_dtPage_SysTest pdtData;
  147.     var i32x i;
  148.  
  149.     // get this pointer
  150.     pthis = GetThis();
  151.  
  152.     // Get Data pointer
  153.     pdtData = GetData(pthis);
  154.  
  155.     // For each created page send DBSync
  156.     i=0;
  157.     while(i<g_iNumPages)
  158.     {
  159.         gcPage = g_stPage[i].gcPage;
  160.         if(g_stPage[i].bCreated == true)
  161.         {
  162.             if(gcPage)
  163.             {
  164.                 gcPage<<DatabaseSync();
  165.             }
  166.         }
  167.         i=i+1;
  168.     }
  169.  
  170.     if(pdtData.m_bLogued == false)
  171.     {
  172.         // Enable Tab control
  173.         pdtData.gcControlTab<<Enable();
  174.  
  175.         // Hide progress bar
  176.         pdtData.gcProgressBar<<Hide();
  177.  
  178.         pdtData.m_bLogued = true;
  179.         if(g_stPage[g_Page_Start].gcPage)
  180.             g_stPage[g_Page_Start].gcPage<<Logued(true);
  181.         pdtData.m_bForceLoad = true;
  182.  
  183.         if(isDemo())
  184.         {
  185.             println("We are in the demo goto race... ");
  186.             //Go to prerace and set ready
  187.             Database_SetIntData(DATABASE_CLIENT,"GAM_user.fkIDuser_state",ROW_KEY,GetMyUserId(),2);
  188.  
  189.             // Create user form
  190.             pdtData.gcStatus = NewUserVoteForm();
  191.             MountComponent(pthis,pdtData.gcStatus);
  192.             pdtData.gcStatus<<FormFilterByIntEqual("GAM_user.IDuser",GetMyUserId());
  193.             pdtData.gcStatus<<SendRecord(g_pMenuServerSocket,"ReadyDB");
  194.             pdtData.gcStatus<<Hide();
  195.         }
  196.         else
  197.         {
  198.             SysTest_DisplayPage(g_Page_Start);
  199.             // Create user form
  200.             pdtData.gcStatus = NewUserVoteForm();
  201.             MountComponent(pthis,pdtData.gcStatus);
  202.             pdtData.gcStatus<<FormFilterByIntEqual("GAM_user.IDuser",GetMyUserId());
  203.         }
  204.  
  205.         MoveTo(pdtData.gcStatus,g_iScreenWidth-256, 4.0*g_fScreenScaleFactor);
  206.     }
  207.  
  208.     // Update user
  209.     print("SyncDatabase:UserId:"+itoa(GetMyUserId())+"\n");
  210. }
  211.  
  212. func void SysTest_DisplayPage(i32x _iPageId)
  213. {
  214.     var Gui_Component pthis,ptab;
  215.     var Gui_dtPage_SysTest pdtData;
  216.  
  217.     // get this pointer
  218.     pthis = GetThis();
  219.  
  220.     // Get Data pointer
  221.     pdtData = GetData(pthis);
  222.  
  223.     if((pdtData.m_bForceLoad)||(pdtData.m_iPageId != _iPageId))
  224.     {
  225.         pdtData.m_bForceLoad = false;
  226.         // Come from race ?
  227.         if(pdtData.m_iPageId == g_Page_Race)
  228.         {
  229.             pdtData.gcControlTab<<BackgroundTab(g_Page_Start);
  230.             pdtData.gcBackground<<Show();
  231.             pdtData.gcTopPanel<<Show();
  232.             if (isDemo()==0)
  233.             {
  234.                 if(pdtData.m_iRaceRunning==1)
  235.                     pdtData.gcJoinRace<<Show();
  236.                 else
  237.                 {
  238.                     pdtData.gcJoinRace<<Hide();
  239.                     if(pdtData.gcStatus)
  240.                         pdtData.gcStatus<<Show();
  241.                 }
  242.             }
  243.         }
  244.  
  245.         if(isDemo())
  246.         {
  247.             print("ShowOutro\n");
  248.             _iPageId = g_Page_Outro;
  249.         }
  250.  
  251.         if(g_stPage[_iPageId].bCreated == false)
  252.         {
  253.             ptab = g_stPage[_iPageId].gcPage;
  254.             ptab<<Create();
  255.             g_stPage[_iPageId].bCreated = true;
  256.         }
  257.  
  258.         // Show Page
  259.         pdtData.m_iLastPageId = pdtData.m_iPageId;
  260.         pdtData.m_iPageId = _iPageId;
  261.         if(g_stPage[_iPageId].bDialbox)
  262.         {
  263.             pdtData.gcControlTab<<ShowTabOver(_iPageId);
  264.         }
  265.         else
  266.         {
  267.             pdtData.gcControlTab<<ShowTab(_iPageId);
  268.         }
  269.  
  270.         // Test if last page should be releases (not detroyed)
  271.         if(g_stPage[pdtData.m_iLastPageId].bDestroy)
  272.         {
  273.             // Send release message to page
  274.             g_stPage[pdtData.m_iLastPageId].gcPage<<Release();
  275.             // Page must be recreated
  276.             g_stPage[pdtData.m_iLastPageId].bCreated = false;
  277.         }
  278.     }
  279. }
  280.  
  281. func void SysTest_DisplayRace()
  282. {
  283.     var Gui_Component pthis,ptab;
  284.     var Gui_dtPage_SysTest pdtData;
  285.  
  286.     // get this pointer
  287.     pthis = GetThis();
  288.  
  289.     // Get Data pointer
  290.     pdtData = GetData(pthis);
  291.  
  292.     // Prepare Client for race
  293.     // inform c++ to change loop
  294.     StartRace();
  295.  
  296.     // Hide background component
  297.     pdtData.gcControlTab<<BackgroundTab(-1);
  298.     pdtData.gcBackground<<Hide();
  299.     pdtData.gcTopPanel<<Hide();
  300.     pdtData.gcJoinRace<<Hide();
  301.     if(pdtData.gcStatus) pdtData.gcStatus<<Hide();
  302.  
  303.  
  304.     if(g_stPage[g_Page_Race].bCreated == false)
  305.     {
  306.         ptab = g_stPage[g_Page_Race].gcPage;
  307.         ptab<<Create();
  308.         g_stPage[g_Page_Race].bCreated = true;
  309.     }
  310.     pdtData.m_iLastPageId = pdtData.m_iPageId;
  311.     pdtData.m_iPageId = g_Page_Race;
  312.  
  313.     // Show Race Page
  314.     pdtData.gcControlTab<<ShowTab(g_Page_Race);
  315. }
  316.  
  317. func void SysTest_Back()
  318. {
  319.     var Gui_Component pthis,ptab;
  320.     var Gui_dtPage_SysTest pdtData;
  321.  
  322.     // get this pointer
  323.     pthis = GetThis();
  324.  
  325.     // Get Data pointer
  326.     pdtData = GetData(pthis);
  327.  
  328.     // Simply return to last page id
  329.     //print("Go back to page:"+itoa(pdtData.m_iLastPageId)+"\n");
  330.     SysTest_DisplayPage(pdtData.m_iLastPageId);
  331.     pdtData.m_iLastPageId = g_Page_Start;
  332. }
  333.  
  334.  
  335. func void SysTest_OnClick(Gui_Component _pComponent)
  336. {
  337.     var Gui_Component pthis,ptab;
  338.     var Gui_dtPage_SysTest pdtData;
  339.  
  340.     // get this pointer
  341.     pthis = GetThis();
  342.  
  343.     // Get Data pointer
  344.     pdtData = GetData(pthis);
  345.  
  346.     if(pdtData.gcJoinRace == _pComponent)
  347.     {
  348.         pthis<<LoadRace();
  349.     }
  350. }
  351.  
  352. func void SysTest_OnUpdateGroupsFunc()
  353. {
  354.     var Gui_Component pthis;
  355.     var Gui_dtPage_SysTest pdtData;
  356.  
  357.     // get this pointer
  358.     pthis = GetThis();
  359.  
  360.     // Get Data pointer
  361.     pdtData = GetData(pthis);
  362.  
  363.     if(pdtData.m_iPageId == g_Page_Race)
  364.     {
  365.         // Send message to race page
  366.         g_stPage[g_Page_Race].gcPage<<UpdateGroups();
  367.     }
  368. }
  369.  
  370.  
  371. func void SysTest_OnLoadRace ()
  372. {
  373.     var Gui_Component pthis,ptab;
  374.     var Gui_dtPage_SysTest pdtData;
  375.     var i32x iStageId;
  376.  
  377.     // get this pointer
  378.     pthis = GetThis();
  379.  
  380.     // Get Data pointer
  381.     pdtData = GetData(pthis);
  382.  
  383.     // init race client
  384.     iStageId = Join_GetIntFromIndex(g_oMenuJoins.m_iConfig_iCurrentStageId,0);
  385.     print("\tStage "+GetLocalizedFromKey(Join_GetIntFromKey(g_oMenuJoins.m_iStage_iNameId,iStageId))+" Id:"+itoa(iStageId)+"\n");
  386.     print("\tInit race client...\n");
  387.     InitRaceClient(DATABASE_CLIENT, iStageId);
  388.  
  389.     // this will start the udp handshake
  390.     // when it is finished UDPHandshakeFinishedCB is called back
  391.     print("\tStart UDP Handshaking...\n");
  392.     // tutu debug : no udp authorization...
  393.     if(g_oGameConfig.m_iSinglePlayer)
  394.     {
  395.         println("\t\tIp:"+g_oMenuServer.m_szIP);
  396.         println("\t\tPort:"+itoa(g_iInRaceServerPort));
  397.         println("\t\tLogin:Cyanide");
  398.         StartHandshake(g_oMenuServer.m_szIP,g_iInRaceServerPort,"Cyanide");
  399.     }
  400.     else
  401.     {
  402.         println("\t\tIp:"+g_oMenuServer.m_szIP);
  403.         println("\t\tPort:"+itoa(g_iInRaceServerPort));
  404.         println("\t\tLogin:"+Join_GetStringFromIndex( g_oLocalJoins.m_iUser_szName, 0));
  405.         StartHandshake(g_oMenuServer.m_szIP,g_iInRaceServerPort,Join_GetStringFromIndex( g_oLocalJoins.m_iUser_szName, 0));
  406.     }
  407. }
  408.  
  409.  
  410. func i32x SysTest_OnUDPHandshakeFinished(i32x _iSuccess)
  411. {
  412.     var Gui_Component pthis,ptab;
  413.     var Gui_dtPage_SysTest pdtData;
  414.  
  415.     // get this pointer
  416.     pthis = GetThis();
  417.  
  418.     // Get Data pointer
  419.     pdtData = GetData(pthis);
  420.  
  421.     print("\tHandshaking finished...");
  422.  
  423.     if (_iSuccess)
  424.     {
  425.         print(" Ok !\n");
  426.         pdtData.m_iHandshake = 1;
  427.         // ready to receive udp messages
  428.         g_pMenuServerSocket << mStartUDP();
  429.         
  430.         // Start wait for pos
  431.         print("\tWait for position...\n");
  432.         StartWaitForPos();
  433.     }
  434.     else
  435.     {
  436.         print(" Failed : Stop race.\n");
  437.         pdtData.m_iHandshake = 0;
  438.         // destroy race
  439.         StopRace();
  440.     }
  441.     return 1;
  442. }
  443.  
  444. func i32x SysTest_OnWaitForPosFinished(i32x _iSuccess)
  445. {
  446.     var Gui_Component pthis,ptab;
  447.     var Gui_dtPage_SysTest pdtData;
  448.  
  449.     // get this pointer
  450.     pthis = GetThis();
  451.  
  452.     // Get Data pointer
  453.     pdtData = GetData(pthis);
  454.     
  455.     print("\tWait for position finished...");
  456.  
  457.     if (_iSuccess)
  458.     {
  459.         pdtData.m_iWaitForPos = 1;
  460.         print(" Ok !\n");
  461.  
  462.         // Load in race page
  463.         pthis<<DisplayRace();
  464.     }
  465.     else
  466.     {
  467.         pdtData.m_iWaitForPos = 0;
  468.         print(" Failed !\n");
  469.     }
  470.     return 1;
  471. }
  472.  
  473. func void SysTest_OnInRaceStop()
  474. {
  475.     var Gui_Component pthis;
  476.     var Gui_dtPage_SysTest pdtData;
  477.  
  478.     // get this pointer
  479.     pthis = GetThis();
  480.  
  481.     // Get Data pointer
  482.     pdtData = GetData(pthis);
  483.  
  484.     pdtData.m_iRaceRunning = 0;
  485.     pdtData.gcJoinRace<<Hide();
  486.  
  487.     // Send message to race page if created
  488.     if(g_stPage[g_Page_Race].bCreated)
  489.     {
  490.         g_stPage[g_Page_Race].gcPage<<ShowPodium();
  491.     }
  492.     else
  493.     {
  494.         if(pdtData.gcStatus)
  495.             pdtData.gcStatus<<Show();
  496.     }
  497. }
  498.  
  499. func void SysTest_CreateGame(i32x _iGameId)
  500. {
  501.     var i32x iMode,iDay,iFirstlaunch;
  502.     var szx szDb;
  503.     var Gui_Component pthis;
  504.     var Gui_dtPage_SysTest pdtData;
  505.  
  506.     var boolx bGateway;
  507.     var szx szGatewayIP;
  508.  
  509.     // tutu debug : no gateway
  510.     bGateway = 0;
  511.     szGatewayIP = "NoIP";
  512.  
  513.     // get this pointer
  514.     pthis = GetThis();
  515.  
  516.     // Get Data pointer
  517.     pdtData = GetData(pthis);
  518.  
  519.     
  520.     if(_iGameId)
  521.     {
  522.         szDb            = Join_GetStringFromKey(g_oLocalJoins.m_iSSlot_szDatabase,    _iGameId);
  523.         iFirstlaunch    = Join_GetIntFromKey(    g_oLocalJoins.m_iSSlot_bFirstLaunch,_iGameId);
  524.         iMode            = Join_GetIntFromKey(    g_oLocalJoins.m_iSSlot_iGameMode,    _iGameId);
  525.         
  526.         if ((iMode == 2) && (iFirstlaunch))
  527.         {
  528.             // Race mode : select a specific stage
  529.             iDay = Database_GetIntData(DATABASE_LOCAL, "GAM_slot.fkIDstage.STA_stage.fkIDday", ROW_KEY, _iGameId);
  530.         }
  531.         else
  532.         {
  533.             iDay = 1;
  534.         }
  535.     }
  536.     else
  537.     {
  538.         szDb            = "Database/Demo.cdb";
  539.         iFirstlaunch    = 0;
  540.         iMode            = 1;
  541.         iDay = 0;
  542.     }
  543.  
  544.     
  545.  
  546.     // Disable Tab control avoid page change
  547.     pdtData.gcControlTab<<Disable();
  548.  
  549.     // Show progress bar
  550.     pdtData.gcProgressBar<<Show();
  551.  
  552.     // create menu server
  553.     CreateMenuServer( bGateway, szGatewayIP, szDb, iFirstlaunch, iMode, iDay );
  554.  
  555.     // Game is no more new
  556.     if(_iGameId)
  557.     {
  558.         Join_SetIntFromKey(    g_oLocalJoins.m_iSSlot_bFirstLaunch,_iGameId,0);
  559.     }
  560.  
  561.     // admin is automatically connected to the menu server
  562.     g_oMenuServer.m_szIP = "127.0.0.1";
  563.     g_oMenuServer.m_iPort = g_iServerPort;
  564.     g_pMenuServerSocket = NetClient_Create( g_oMenuServer.m_szIP, g_oMenuServer.m_iPort, g_gcManager );
  565. }
  566.  
  567. func i32x SysTest_OnGainFocus()
  568. {
  569.     // Take focus
  570.     return 1;
  571. }
  572. func i32x SysTest_OnKeyDown(i32x _iKey,i32x _iCount)
  573. {
  574.     return 1;
  575. }
  576.  
  577. func void SysTest_OnQuitGame()
  578. {
  579.     var Gui_Component pthis;
  580.     var Gui_dtPage_SysTest pdtData;
  581.  
  582.     // get this pointer
  583.     pthis = GetThis();
  584.  
  585.     // Get Data pointer
  586.     pdtData = GetData(pthis);
  587.  
  588.     
  589.     if(isDemo())
  590.     {
  591.         ExitNow();
  592.     }
  593.  
  594.     // Destroy user form
  595.     pdtData.gcStatus = DeleteComponent(pdtData.gcStatus);
  596.     pdtData.gcStatus = NULL;
  597.  
  598.     // Disconnect from server if needed
  599.     if(g_pMenuServerSocket)
  600.     {
  601.         NetClient_Disconnect(g_pMenuServerSocket);
  602.     }
  603.     pdtData.m_bLogued = false;
  604.     g_stPage[g_Page_Start].gcPage<<Logued(false);
  605.     pdtData.m_bForceLoad = true;
  606.     SysTest_DisplayPage(g_Page_Start);
  607. }
  608.  
  609. func void SysTest_OnExitGame()
  610. {
  611.     var Gui_Component pthis;
  612.     var Gui_dtPage_SysTest pdtData;
  613.  
  614.     // get this pointer
  615.     pthis = GetThis();
  616.  
  617.     // Get Data pointer
  618.     pdtData = GetData(pthis);
  619.         print("Exitgame2\n");
  620.  
  621.     // Exit cycling manager 2    
  622.     ExitNow();
  623. }
  624.  
  625.  
  626. func void SysTest_OnInRaceStart(i32x _iInRaceTeamID)
  627. {
  628.     var Gui_Component pthis,ptab;
  629.     var Gui_dtPage_SysTest pdtData;
  630.  
  631.     // get this pointer
  632.     pthis = GetThis();
  633.  
  634.     // Get Data pointer
  635.     pdtData = GetData(pthis);
  636.  
  637.     println("Can start race with TeamID:" + itoa(_iInRaceTeamID));
  638.  
  639.     pdtData.m_iRaceRunning = 1;
  640.     if(pdtData.gcStatus) pdtData.gcStatus<<Hide();
  641.     if (isDemo()==0)
  642.     {
  643.         pdtData.gcJoinRace<<Show();
  644.     }
  645. }
  646.  
  647. func void SysTest_ShowHelp(szx _szHelp)
  648. {
  649.     var Gui_Component pthis,ptab;
  650.     var Gui_dtPage_SysTest pdtData;
  651.  
  652.     // get this pointer
  653.     pthis = GetThis();
  654.  
  655.     // Get Data pointer
  656.     pdtData = GetData(pthis);
  657.  
  658.     if(strcmp(pdtData.m_szHelp,_szHelp))
  659.     {
  660.         pdtData.gcContextualHelp<<Caption(_szHelp);
  661.         pdtData.gcContextualHelp<<Show();
  662.     }
  663. }
  664.  
  665.  
  666. func void SysTest_ShowHint(szx _szText)
  667. {
  668.     var Gui_Component pthis, phint;
  669.     var Gui_dtPage_SysTest pdtPage;
  670.     pthis = GetThis();
  671.     pdtPage = GetData(pthis);
  672.     phint = pdtPage.gcHint;
  673.  
  674.     phint<<HintSet(_szText);
  675.  
  676.     var Gui_dtHintTimer pdtTimer;
  677.     pdtTimer = new Gui_dtHintTimer;
  678.  
  679.     AddInterface(phint, Gui_iHintTimer, pdtTimer);
  680. }
  681.  
  682. func void SysTest_MoveHint(i32x _AbsX, i32x _AbsY)
  683. {
  684.     var Gui_Component pthis, phint;
  685.     var Gui_dtPage_SysTest pdtPage;
  686.     var Gui_dtHint pdtHint;
  687.     var Menu_Sprite sprite;
  688.     pthis = GetThis();
  689.     pdtPage = GetData(pthis);
  690.     phint = pdtPage.gcHint;
  691.  
  692.     pdtHint = GetPrimaryData(phint);
  693.     
  694.     var i32x posX, posY;
  695.  
  696.     if ((_AbsX + 32 + pdtHint.iWidth + 5) <= g_iScreenWidth)
  697.         posX = _AbsX + 32;
  698.     else
  699.         posX = g_iScreenWidth - pdtHint.iWidth - 5;
  700.  
  701.     if ((_AbsY + 32 + pdtHint.iHeight) <= g_iScreenHeight)
  702.         posY = _AbsY + 32;
  703.     else
  704.         posY = _AbsY - pdtHint.iHeight;
  705.  
  706.     MoveTo(phint, posX, posY);
  707. }
  708.  
  709. func void SysTest_HideHint()
  710. {
  711.     var Gui_Component pthis, ptab, phint, pcomponent;
  712.     var Gui_dtPage_SysTest pdtPage;
  713.     var Gui_dtHint pdtHint;
  714.     pthis = GetThis();
  715.     pdtPage = GetData(pthis);
  716.     phint = pdtPage.gcHint;
  717.     phint<<HintReset();
  718. }
  719.  
  720.  
  721.  
  722. func void SysTest_HideHelp()
  723. {
  724.     var Gui_Component pthis,ptab;
  725.     var Gui_dtPage_SysTest pdtData;
  726.  
  727.     // get this pointer
  728.     pthis = GetThis();
  729.  
  730.     // Get Data pointer
  731.     pdtData = GetData(pthis);
  732.  
  733.     pdtData.gcContextualHelp<<Hide();
  734. }
  735.  
  736.  
  737.  
  738.  
  739. func void AddHelpInterface(Gui_Component _pComponent,szx _szCaption)
  740. {
  741.      var Gui_dtHelpData pdtData;
  742.         pdtData=new Gui_dtHelpData;
  743.         pdtData.szCaption=_szCaption;
  744.         //println("AddHelpInterface "+_szCaption);
  745.         AddInterface(_pComponent,Gui_iHelpInterface,pdtData);
  746. }
  747.  
  748. func i32x HelpInterface_OnMouseEnter(i32x _iX,i32x _iY)
  749. {
  750.     var Gui_dtHelpData pdtData;
  751.     pdtData=GetData(GetThis());
  752.     
  753.     if(strlen(pdtData.szCaption)>=1)
  754.     {
  755.         g_gcManager<<MoveHint(_iX,_iY);
  756.         g_gcManager<<ShowHint(pdtData.szCaption);
  757.         g_cCurrentHelpComponent=GetThis();
  758.     }
  759.     return 1;
  760. }
  761.  
  762.  
  763. func i32x HelpInterface_OnMouseLeave(i32x _iX,i32x _iY)
  764. {
  765.     var Gui_dtHelpData pdtData;
  766.     pdtData=GetData(GetThis());
  767.     
  768.     if(strlen(pdtData.szCaption)>=1)
  769.     {
  770.         if(g_cCurrentHelpComponent==GetThis())
  771.         {
  772.             g_gcManager<<HideHint();
  773.             g_cCurrentHelpComponent=NULL;
  774.         }
  775.     }
  776.     return 1;
  777. }
  778.  
  779.  
  780. func i32x HelpInterface_OnSetHelpString(szx _szHelp)
  781. {
  782.  var Gui_dtHelpData pdtData;
  783.     pdtData=GetData(GetThis());
  784.     pdtData.szCaption=_szHelp;
  785.     
  786.     if(strlen(pdtData.szCaption)>=1)
  787.     {
  788.         if(g_cCurrentHelpComponent==GetThis())
  789.         {
  790.             g_gcManager<<HideHint();
  791.             g_gcManager<<ShowHint(pdtData.szCaption);
  792.         }    
  793.     }
  794. }
  795.  
  796.  
  797.  
  798.  
  799. func void SysTest_OnProgress(szx _szMessage,f32x _fValue)
  800. {
  801.     var Gui_Component pthis;
  802.     var Gui_dtPage_SysTest pdtData;
  803.  
  804.     // get this pointer
  805.     pthis = GetThis();
  806.  
  807.     // Get Data pointer
  808.     pdtData = GetData(pthis);
  809.  
  810.     // Update progress bar
  811.     pdtData.gcProgressBar<<Progress(_szMessage,_fValue);
  812. }
  813. func void SysTest_OnLoadProgress(szx _szMessage,f32x _fValue)
  814. {
  815. //    print(_szMessage+":"+ftoa(_fValue)+"\n");
  816.     var Gui_Component pthis;
  817.     var Gui_dtPage_SysTest pdtData;
  818.     var f32x fCurrentTime;
  819.  
  820.     // get this pointer
  821.     pthis = GetThis();
  822.  
  823.     // Get Data pointer
  824.     pdtData = GetData(pthis);
  825.  
  826.     // Update progress bar
  827.     fCurrentTime = GetPerformanceTimer();
  828.     if(IsHidden(pdtData.gcProgressBar))
  829.     {
  830.         pdtData.m_fLastTime = 0.0;
  831.         pdtData.gcProgressBar<<Show();
  832.     }
  833.  
  834.     if((fCurrentTime-pdtData.m_fLastTime)>(1.0/60.0))
  835.     {
  836.         pdtData.m_fLastTime = fCurrentTime;
  837.         // Make menu one loop
  838.         pdtData.gcProgressBar<<Progress(_szMessage,_fValue);
  839.         ProgressLoop();
  840.     }
  841. }
  842. func void SysTest_OnEndLoadProgress()
  843. {
  844.     var Gui_Component pthis;
  845.     var Gui_dtPage_SysTest pdtData;
  846.  
  847.     // get this pointer
  848.     pthis = GetThis();
  849.  
  850.     // Get Data pointer
  851.     pdtData = GetData(pthis);
  852.  
  853.     // Update progress bar
  854.     if(!IsHidden(pdtData.gcProgressBar))
  855.         pdtData.gcProgressBar<<Hide();
  856. }
  857.  
  858.  
  859. func void ProgressBar_OnProgress(szx _szMessage,f32x _fValue)
  860. {
  861.     var Gui_Component pthis;
  862.     var Gui_dtDialog_ProgressBar pdtData;
  863.  
  864.     pthis = GetThis();
  865.  
  866.     pdtData = GetData(pthis);
  867.  
  868.     // Update caption
  869.     pdtData.gcMessage<<Caption(_szMessage);
  870.     // Update gauge
  871.     pdtData.gcGauge<<GaugeValue(_fValue);
  872. }
  873. func void ProgressBar_OnEndProgress()
  874. {
  875.     var Gui_Component pthis,parent;
  876.     var Gui_dtDialog_ProgressBar pdtData;
  877.  
  878.     pthis = GetThis();
  879.  
  880.     pdtData = GetData(pthis);
  881.  
  882. }
  883.  
  884. func Gui_Component NewProgressBar()
  885. {
  886.     var Gui_Component pthis;
  887.     var Gui_dtDialog_ProgressBar pdtData;
  888.  
  889.     pdtData = new Gui_dtDialog_ProgressBar;
  890.  
  891.     // New object
  892.     pthis = NewObject(Gui_iDialog_ProgressBar);
  893.     SetData(pthis,pdtData);
  894.  
  895.     // Background
  896.     pdtData.gcBackground = NewBoxFilled(smWhiteFrame,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
  897.     pdtData.gcBackground<<BoxSetColor(cLoadingBackColor);
  898.     MountComponent(pthis,pdtData.gcBackground);
  899.  
  900.     // Message
  901.     pdtData.gcMessage = NewCaption(smLoadingFont, GetLocalizedFromKey(iszWait));
  902.     StretchTo(pdtData.gcMessage,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
  903.     SetColor(pdtData.gcMessage, cLoadingFontColor);
  904.     SetAlign(pdtData.gcMessage,e_GUI_HAlign_Center,e_GUI_VAlign_Top);
  905.     MountComponent(pthis,pdtData.gcMessage);
  906.  
  907.     // Gauge
  908.     pdtData.gcGauge = NewGaugeH(smHGauge, 300.0*g_fScreenScaleFactor, 32);
  909.     MountComponent(pthis,pdtData.gcGauge);
  910.     pdtData.gcGauge<<GaugeValue(0);
  911.     pdtData.gcGauge<<GaugeColor(cLoadingGaugeColor);
  912.     MoveTo(pdtData.gcGauge,25.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor-48);
  913.  
  914.     StretchTo(pthis,350.0*g_fScreenScaleFactor,150.0*g_fScreenScaleFactor);
  915.     return pthis;
  916. }
  917.  
  918. func Gui_Component NewUserVoteForm()
  919. {
  920.     var Gui_Component pform;
  921.     var Gui_dtForm_User pdtData;
  922.     var i32x i,iPosX;
  923.     var szx szTxt;
  924.  
  925.     iPosX = 0;
  926.     pform = NewForm(DATABASE_CLIENT,"GAM_user",false);
  927.     pform<<FormSetDecimal(0);
  928.     pform<<FormSetAlign(e_GUI_HAlign_Center,e_GUI_VAlign_Center);
  929.     pform<<FormSetOffset(2);
  930.  
  931.     pdtData = new Gui_dtForm_User;
  932.     AddInterface(pform,Gui_iForm_User,pdtData);
  933.     
  934.     pform<<FormSetLocked(true);
  935.     pform<<FormSetTitle(false,false);
  936.     pform<<FormSetFontColor(cBlack,cBlack);
  937.     pform<<FormSetLocked(false);
  938.     pform<<FormSetWidth(200);
  939.     pform<<FormSetMaJInform(true);
  940.     pform<<FormShowGroupOptionField("GAM_user.fkIDuser_state","STA_user_state.IDuser_state","STA_user_state.gene_strID_state","",0,0);
  941.     pdtData.gcState = GetLastField(pform);
  942.     pform<<FormSetMaJInform(false);
  943.  
  944.     return pform;
  945. }
  946.  
  947. func Gui_Component NewUserListForm()
  948. {
  949.     var Gui_Component pform;
  950.     var Gui_dtForm_UserList pdtData;
  951.     var i32x i,iPosX;
  952.     var szx szTxt;
  953.  
  954.     pdtData = new Gui_dtForm_UserList;
  955.  
  956.     // New list form
  957.     pform = NewListForm(DATABASE_CLIENT,"GAM_user",false);
  958.  
  959.     AddInterface(pform,Gui_iForm_UserList,pdtData);
  960.  
  961.     return pform;
  962. }
  963. func void UserListForm_OnAddForm(Gui_Component _pform,i32x _iIndex)
  964. {
  965.     var Gui_dtForm_UserList pdtData;
  966.     var i32x i,iPosX;
  967.     var szx szTxt;
  968.  
  969.     iPosX = 0;
  970.     _pform<<FormSetDecimal(0);
  971.     _pform<<FormSetAlign(e_GUI_HAlign_Center,e_GUI_VAlign_Center);
  972.     _pform<<FormSetOffset(2);
  973.     _pform<<FormSetLocked(true);
  974.     _pform<<FormSetTitle(false,false);
  975.     _pform<<FormSetWidth(100);
  976.     _pform<<FormShowField("GAM_user.game_sz_login","",iPosX,0);
  977.     iPosX = iPosX + 100;
  978.     _pform<<FormSetWidth(148);
  979.     _pform<<FormSetMaJInform(false);
  980.     _pform<<FormShowField("GAM_user.fkIDuser_state.STA_user_state.gene_strID_state","",iPosX,0);
  981. }
  982. func void UserForm_OnMaJInt(Gui_Component _poField,i32x _iValue,i32x _bChanged)
  983. {
  984.     var Gui_Component pthis,pback;
  985.     var Gui_dtForm_User pdtData;
  986.  
  987.     if(_bChanged)
  988.     {
  989.         // get this pointer
  990.         pthis = GetThis();
  991.  
  992.         // Get Data pointer
  993.         pdtData = GetData(pthis);
  994.  
  995.         if(_poField == pdtData.gcState)
  996.         {
  997.             pthis<<SendRecord(g_pMenuServerSocket,"ReadyDB");
  998.         }
  999.     }
  1000. }
  1001.  
  1002. func void ShowContextualHelp(szx _szHelp)
  1003. {
  1004.     // Send message to manager component
  1005.     g_gcManager<<ShowHelp(_szHelp);
  1006. }
  1007. func void HideContextualHelp()
  1008. {
  1009.     // Send message to manager component
  1010.     g_gcManager<<HideHelp();
  1011. }
  1012.  
  1013.  
  1014. // Data class
  1015. class Gui_dtDbgObject
  1016. {
  1017.     var Gui_Component gcCaption;
  1018.     var Gui_Component gcBorder;
  1019. };
  1020.  
  1021. // Debug object
  1022. func Gui_Component NewDebugObject()
  1023. {
  1024.     var Gui_Component caption,container,composite;
  1025.     var Gui_dtDbgObject pdtData;
  1026.  
  1027.     // Create an object that will contain Bitmap buton + caption
  1028.     composite = NewObject(Gui_iDbgObject);
  1029.     pdtData = new Gui_dtDbgObject;
  1030.     SetData(composite,pdtData);
  1031.  
  1032.  
  1033.     // Two component in composite button
  1034.     SetComponentNumber(composite,2);
  1035.  
  1036.     // Create A caption Button
  1037.     caption = NewCaption(smArial,"");
  1038.     SetScale(caption,0.5);
  1039.  
  1040.     // Create a bitmap
  1041.     container = NewBitmap(smWhite,0);
  1042.     StretchTo(container,g_iScreenWidth,g_iScreenHeight);
  1043.     SetFillMode(GetSprite(container),DLC_Fill_Wireframe);
  1044.     SetAlign(container,e_GUI_HAlign_Zoom,e_GUI_VAlign_Zoom);
  1045.  
  1046.     // Disable caption
  1047.     caption<<Disable();
  1048.     container<<Disable();
  1049.  
  1050.     // Mount containers into object
  1051.     MountComponent(composite,container);
  1052.     MountComponent(composite,caption);
  1053.  
  1054.     pdtData.gcCaption = caption;
  1055.     pdtData.gcBorder = container;
  1056.  
  1057.     // Stretch composite
  1058.     StretchTo(composite,g_iScreenWidth,g_iScreenHeight);
  1059.  
  1060.     return composite;
  1061. }
  1062. func i32x Debug_OnDebug(szx _szEvent,i32x _iPosX,i32x _iPosY,i32x _iSizeX,i32x _iSizeY)
  1063. {
  1064.     var Gui_Component pthis,ptab;
  1065.     var Gui_dtDbgObject pdtData;
  1066.  
  1067.     // get this pointer
  1068.     pthis = GetThis();
  1069.  
  1070.     // Get Data pointer
  1071.     pdtData = GetData(pthis);
  1072.  
  1073.     // Affect new text to caption
  1074.     pdtData.gcCaption<<Caption(_szEvent);
  1075.  
  1076.     StretchTo(pdtData.gcBorder,_iSizeX,_iSizeY);
  1077.     MoveTo(pdtData.gcBorder,_iPosX,_iPosY);
  1078. }
  1079. func i32x Debug_OnDestroy()
  1080. {
  1081.     print("Destroy_Debug Object\n");
  1082. }
  1083. /*
  1084.  * Page definition
  1085.  */
  1086. func void MakePages()
  1087. {
  1088.     var Gui_Component gcPage;
  1089.     var i32x i;
  1090.     i=0;
  1091.  
  1092.     // Start page
  1093.     g_stPage[i].gcPage = NewObject(Gui_iPage_Start);
  1094.     g_stPage[i].bCreated = false;
  1095.     g_stPage[i].bDynamic = false;
  1096.     g_stPage[i].bDestroy = false;
  1097.     g_stPage[i].bDialbox = false;
  1098.     g_Page_Start = i;
  1099.     i=i+1;
  1100.  
  1101.     g_stPage[i].gcPage = NewObject(Gui_iPage_Roster);
  1102.     g_stPage[i].bCreated = false;
  1103.     g_stPage[i].bDynamic = true;
  1104.     g_stPage[i].bDestroy = false;
  1105.     g_stPage[i].bDialbox = false;
  1106.     g_Page_Roster = i;
  1107.     i=i+1;
  1108.  
  1109.     g_stPage[i].gcPage = NewObject(Gui_iPage_RosterCyclist);
  1110.     g_stPage[i].bCreated = false;
  1111.     g_stPage[i].bDynamic = true;
  1112.     g_stPage[i].bDestroy = true;
  1113.     g_stPage[i].bDialbox = false;
  1114.     g_Page_RosterCyclist = i;
  1115.     i=i+1;
  1116.  
  1117.     g_stPage[i].gcPage = NewObject(Gui_iPage_RosterStaff);
  1118.     g_stPage[i].bCreated = false;
  1119.     g_stPage[i].bDynamic = true;
  1120.     g_stPage[i].bDestroy = false;
  1121.     g_stPage[i].bDialbox = false;
  1122.     g_Page_RosterStaff = i;
  1123.     i=i+1;
  1124.  
  1125.     g_stPage[i].gcPage = NewObject(Gui_iPage_TeamInfo);
  1126.     g_stPage[i].bCreated = false;
  1127.     g_stPage[i].bDynamic = true;
  1128.     g_stPage[i].bDestroy = false;
  1129.     g_stPage[i].bDialbox = false;
  1130.     g_Page_MedicalDistrib = i;
  1131.     i=i+1;
  1132.  
  1133.     g_stPage[i].gcPage = NewObject(Gui_iPage_MedicalReports);
  1134.     g_stPage[i].bCreated = false;
  1135.     g_stPage[i].bDynamic = false;
  1136.     g_stPage[i].bDestroy = false;
  1137.     g_stPage[i].bDialbox = false;
  1138.     g_Page_MedicalReports = i;
  1139.     i=i+1;
  1140.  
  1141.     g_stPage[i].gcPage = NewObject(Gui_iPage_MedicalDiagram);
  1142.     g_stPage[i].bCreated = false;
  1143.     g_stPage[i].bDynamic = false;
  1144.     g_stPage[i].bDestroy = false;
  1145.     g_stPage[i].bDialbox = false;
  1146.     g_Page_MedicalDiagram = i;
  1147.     i=i+1;
  1148.  
  1149.     g_stPage[i].gcPage = NewObject(Gui_iPage_Season);
  1150.     g_stPage[i].bCreated = false;
  1151.     g_stPage[i].bDynamic = true;
  1152.     g_stPage[i].bDestroy = false;
  1153.     g_stPage[i].bDialbox = false;
  1154.     g_Page_Season = i;
  1155.     i=i+1;
  1156.  
  1157.     
  1158.     g_stPage[i].gcPage = NewObject(Gui_iPage_Finance);
  1159.     g_stPage[i].bCreated = false;
  1160.     g_stPage[i].bDynamic = false;
  1161.     g_stPage[i].bDestroy = false;
  1162.     g_stPage[i].bDialbox = false;
  1163.     g_Page_Finance = i;
  1164.     i=i+1;
  1165.  
  1166.     g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceContracts);
  1167.     g_stPage[i].bCreated = false;
  1168.     g_stPage[i].bDynamic = true;
  1169.     g_stPage[i].bDestroy = false;
  1170.     g_stPage[i].bDialbox = false;
  1171.     g_Page_FinanceContracts = i;
  1172.     i=i+1;
  1173.  
  1174.     g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceReports);
  1175.     g_stPage[i].bCreated = false;
  1176.     g_stPage[i].bDynamic = false;
  1177.     g_stPage[i].bDestroy = false;
  1178.     g_stPage[i].bDialbox = false;
  1179.     g_Page_FinanceReports = i;
  1180.     i=i+1;
  1181.  
  1182.     g_stPage[i].gcPage = NewObject(Gui_iPage_FinanceStatement);
  1183.     g_stPage[i].bCreated = false;
  1184.     g_stPage[i].bDynamic = true;
  1185.     g_stPage[i].bDestroy = false;
  1186.     g_stPage[i].bDialbox = false;
  1187.     g_Page_FinanceStatement = i;
  1188.     i=i+1;
  1189.  
  1190.     g_stPage[i].gcPage = NewObject(Gui_iPage_News);
  1191.     g_stPage[i].bCreated = false;
  1192.     g_stPage[i].bDynamic = true;
  1193.     g_stPage[i].bDestroy = false;
  1194.     g_stPage[i].bDialbox = false;
  1195.     g_Page_News = i;
  1196.     i=i+1;
  1197.  
  1198.     g_stPage[i].gcPage = NewObject(Gui_iPage_Palmares);
  1199.     g_stPage[i].bCreated = false;
  1200.     g_stPage[i].bDynamic = true;
  1201.     g_stPage[i].bDestroy = false;
  1202.     g_stPage[i].bDialbox = false;
  1203.     g_Page_Palmares = i;
  1204.     i=i+1;
  1205.  
  1206.     g_stPage[i].gcPage = NewObject(Gui_iPage_Classification);
  1207.     g_stPage[i].bCreated = false;
  1208.     g_stPage[i].bDynamic = true;
  1209.     g_stPage[i].bDestroy = true;
  1210.     g_stPage[i].bDialbox = false;
  1211.     g_Page_Classification = i;
  1212.     i=i+1;
  1213.  
  1214.     g_stPage[i].gcPage = NewObject(Gui_iPage_Training);
  1215.     g_stPage[i].bCreated = false;
  1216.     g_stPage[i].bDynamic = true;
  1217.     g_stPage[i].bDestroy = false;
  1218.     g_stPage[i].bDialbox = false;
  1219.     g_Page_Training = i;
  1220.     i=i+1;
  1221.  
  1222.     g_stPage[i].gcPage = NewObject(Gui_iPage_TrainingSeason);
  1223.     g_stPage[i].bCreated = false;
  1224.     g_stPage[i].bDynamic = true;
  1225.     g_stPage[i].bDestroy = true;
  1226.     g_stPage[i].bDialbox = false;
  1227.     g_Page_TrainingSeason = i;
  1228.     i=i+1;
  1229.  
  1230.     g_stPage[i].gcPage = NewObject(Gui_iPage_TrainingWeek);
  1231.     g_stPage[i].bCreated = false;
  1232.     g_stPage[i].bDynamic = true;
  1233.     g_stPage[i].bDestroy = true;
  1234.     g_stPage[i].bDialbox = false;
  1235.     g_Page_TrainingWeek = i;
  1236.     i=i+1;
  1237.  
  1238.     g_stPage[i].gcPage = NewObject(Gui_iPage_PreRace);
  1239.     g_stPage[i].bCreated = false;
  1240.     g_stPage[i].bDynamic = true;
  1241.     g_stPage[i].bDestroy = false;
  1242.     g_stPage[i].bDialbox = false;
  1243.     g_Page_PreRace = i;
  1244.     i=i+1;
  1245.  
  1246.     g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceSelection);
  1247.     g_stPage[i].bCreated = false;
  1248.     g_stPage[i].bDynamic = true;
  1249.     g_stPage[i].bDestroy = false;
  1250.     g_stPage[i].bDialbox = false;
  1251.     g_Page_PreRaceSelection = i;
  1252.     i=i+1;
  1253.  
  1254.     g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceStrategy);
  1255.     g_stPage[i].bCreated = false;
  1256.     g_stPage[i].bDynamic = true;
  1257.     g_stPage[i].bDestroy = false;
  1258.     g_stPage[i].bDialbox = false;
  1259.     g_Page_PreRaceStrategy = i;
  1260.     i=i+1;
  1261.  
  1262.     g_stPage[i].gcPage = NewObject(Gui_iPage_PreRaceEquipment);
  1263.     g_stPage[i].bCreated = false;
  1264.     g_stPage[i].bDynamic = true;
  1265.     g_stPage[i].bDestroy = false;
  1266.     g_stPage[i].bDialbox = false;
  1267.     g_Page_PreRaceEquipment = i;
  1268.     i=i+1;
  1269.  
  1270.     g_stPage[i].gcPage = NewObject(Gui_iPage_CyclistInfo);
  1271.     g_stPage[i].bCreated = false;
  1272.     g_stPage[i].bDynamic = false;
  1273.     g_Page_CyclistInfo = i;
  1274.     i=i+1;
  1275.  
  1276.     g_stPage[i].gcPage = NewObject(Gui_iPage_StaffInfo);
  1277.     g_stPage[i].bCreated = false;
  1278.     g_stPage[i].bDynamic = false;
  1279.     g_stPage[i].bDestroy = false;
  1280.     g_stPage[i].bDialbox = false;
  1281.     g_Page_StaffInfo = i;
  1282.     i=i+1;
  1283.  
  1284.     g_stPage[i].gcPage = NewObject(Gui_iPage_TeamInfo);
  1285.     g_stPage[i].bCreated = false;
  1286.     g_stPage[i].bDynamic = true;
  1287.     g_stPage[i].bDestroy = false;
  1288.     g_stPage[i].bDialbox = false;
  1289.     g_Page_TeamInfo = i;
  1290.     i=i+1;
  1291.  
  1292.     g_stPage[i].gcPage = NewObject(Gui_iPage_ManagerInfo);
  1293.     g_stPage[i].bCreated = false;
  1294.     g_stPage[i].bDynamic = false;
  1295.     g_stPage[i].bDestroy = false;
  1296.     g_stPage[i].bDialbox = false;
  1297.     g_Page_ManagerInfo = i;
  1298.     i=i+1;
  1299.  
  1300.     g_stPage[i].gcPage = NewObject(Gui_iPage_RaceInfo);
  1301.     g_stPage[i].bCreated = false;
  1302.     g_stPage[i].bDynamic = true;
  1303.     g_stPage[i].bDestroy = false;
  1304.     g_stPage[i].bDialbox = false;
  1305.     g_Page_RaceInfo = i;
  1306.     i=i+1;
  1307.  
  1308.     g_stPage[i].gcPage = NewObject(Gui_iPage_StageInfo);
  1309.     g_stPage[i].bCreated = false;
  1310.     g_stPage[i].bDynamic = true;
  1311.     g_stPage[i].bDestroy = true;
  1312.     g_stPage[i].bDialbox = false;
  1313.     g_Page_StageInfo = i;
  1314.     i=i+1;
  1315.  
  1316.     g_stPage[i].gcPage = NewObject(Gui_iPage_ClassInfo);
  1317.     g_stPage[i].bCreated = false;
  1318.     g_stPage[i].bDynamic = false;
  1319.     g_stPage[i].bDestroy = false;
  1320.     g_stPage[i].bDialbox = false;
  1321.     g_Page_ClassInfo = i;
  1322.     i=i+1;
  1323.  
  1324.     g_stPage[i].gcPage = NewObject(Gui_iPage_SponsorInfo);
  1325.     g_stPage[i].bCreated = false;
  1326.     g_stPage[i].bDynamic = false;
  1327.     g_stPage[i].bDestroy = false;
  1328.     g_stPage[i].bDialbox = false;
  1329.     g_Page_SponsorInfo = i;
  1330.     i=i+1;
  1331.  
  1332.     g_stPage[i].gcPage = NewObject(Gui_iPage_ChatRoom);
  1333.     g_stPage[i].bCreated = false;
  1334.     g_stPage[i].bDynamic = false;
  1335.     g_stPage[i].bDestroy = false;
  1336.     g_stPage[i].bDialbox = false;
  1337.     g_Page_ChatRoom = i;
  1338.     i=i+1;
  1339.  
  1340.     g_stPage[i].gcPage = NewObject(Gui_iPage_Race);
  1341.     g_stPage[i].bCreated = false;
  1342.     g_stPage[i].bDynamic = true;
  1343.     g_stPage[i].bDestroy = true;
  1344.     g_stPage[i].bDialbox = false;
  1345.     g_Page_Race = i;
  1346.     i=i+1;
  1347.  
  1348.     g_stPage[i].gcPage = NewObject(Gui_iPage_Init);
  1349.     g_stPage[i].bCreated = false;
  1350.     g_stPage[i].bDynamic = true;
  1351.     g_stPage[i].bDestroy = false;
  1352.     g_stPage[i].bDialbox = false;
  1353.     g_Page_Init = i;
  1354.     i=i+1;
  1355.  
  1356.     g_stPage[i].gcPage = NewObject(Gui_iPage_NewGame);
  1357.     g_stPage[i].bCreated = false;
  1358.     g_stPage[i].bDynamic = true;
  1359.     g_stPage[i].bDestroy = true;
  1360.     g_stPage[i].bDialbox = false;
  1361.     g_Page_New = i;
  1362.     i=i+1;
  1363.  
  1364.     g_stPage[i].gcPage = NewObject(Gui_iPage_JoinGame);
  1365.     g_stPage[i].bCreated = false;
  1366.     g_stPage[i].bDynamic = false;
  1367.     g_stPage[i].bDestroy = false;
  1368.     g_stPage[i].bDialbox = false;
  1369.     g_Page_Join = i;
  1370.     i=i+1;
  1371.  
  1372.     g_stPage[i].gcPage = NewObject(Gui_iPage_InitLoad);
  1373.     g_stPage[i].bCreated = false;
  1374.     g_stPage[i].bDynamic = false;
  1375.     g_stPage[i].bDestroy = false;
  1376.     g_stPage[i].bDialbox = false;
  1377.     g_Page_Load = i;
  1378.     i=i+1;
  1379.  
  1380.     g_stPage[i].gcPage = NewObject(Gui_iPage_Intro);
  1381.     g_stPage[i].bCreated = false;
  1382.     g_stPage[i].bDynamic = true;
  1383.     g_stPage[i].bDestroy = true;
  1384.     g_stPage[i].bDialbox = false;
  1385.     g_Page_Intro = i;
  1386.     i=i+1;
  1387.  
  1388.     g_stPage[i].gcPage = NewObject(Gui_iPage_Outro);
  1389.     g_stPage[i].bCreated = false;
  1390.     g_stPage[i].bDynamic = true;
  1391.     g_stPage[i].bDestroy = true;
  1392.     g_stPage[i].bDialbox = false;
  1393.     g_Page_Outro = i;
  1394.     i=i+1;
  1395.  
  1396.     //print("NumPage:"+itoa(i)+"\n");
  1397.     g_iNumPages = i;
  1398.     // First page index
  1399.     g_iFirstPage = g_Page_Start;
  1400.     g_iFirstPage = g_Page_Intro;
  1401.  
  1402.     // Create static page
  1403.     i=0;
  1404.     while(i<g_iNumPages)
  1405.     {
  1406.         gcPage = g_stPage[i].gcPage;
  1407.         gcPage<<InitData();
  1408.         if(g_stPage[i].bDynamic == false)
  1409.         {
  1410.             gcPage<<Create();
  1411.             g_stPage[i].bCreated = true;
  1412.         }
  1413.         i=i+1;
  1414.     }
  1415. }
  1416.  
  1417.